package org.fuys.coder.domain.file.service.impl;

import org.fuys.coder.domain.file.repository.IFileRepository;
import org.fuys.coder.domain.file.service.IFileService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @projectName: fuys-low-coder
 * @package: org.fuys.coder.domain.file.service.impl
 * @className: FileService
 * @author: WangJing
 * @description: 服务实现
 * @date: 2024/6/28 23:05
 * @version: 1.0
 */
@Service
public class FileService implements IFileService {

    @Resource
    private IFileRepository repository;

    @Override
    public int save(String fileName, String type, Integer userId) {
        return repository.save(fileName,type,userId);
    }

    @Override
    public String getFileKey(Long id) {
        return repository.getFileKey(id);
    }

    @Override
    public List<String> getFileKeys(List<Long> id) {
        return repository.getFileKeys(id);
    }

    @Override
    public boolean checkKey(String fileKey) {
        final Integer fileId = repository.getFileId(fileKey);
        return fileId!=null;
    }
}
